#include "stdafx.h"
#include "resource.h"
#include "addlinedlg.h"

#include <iostream>

AddLineDlg::AddLineDlg( CWnd* pParent )
    : CDialog( IDD_ADDLINE_DIALOG, pParent )
{
}

CString AddLineDlg::GetStr() const
{
    return str;
}

void AddLineDlg::DoDataExchange( CDataExchange* pDX )
{
    CDialog::DoDataExchange( pDX );
    DDX_Control( pDX, IDC_EDIT1, edit );
}

BEGIN_MESSAGE_MAP( AddLineDlg, CDialog )
    ON_BN_CLICKED( IDBROWSE, OnBnClickedBrowse )
    ON_BN_CLICKED( IDOK, OnBnClickedOK )
END_MESSAGE_MAP()

BOOL AddLineDlg::OnInitDialog()
{
    CDialog::OnInitDialog();
    return TRUE;
}

void AddLineDlg::OnBnClickedBrowse()
{
    CFileDialog dlgFile( TRUE );
    dlgFile.DoModal();
    CString filepath = dlgFile.GetPathName();
    edit.SetWindowText( filepath );
}

void AddLineDlg::OnBnClickedOK()
{
    edit.GetWindowText( str );
    OnOK();
}
